//返回的是用户唯一的临时标识uuid
//用户一点有了唯一标识 不会轻易改变的 localStorage
import { v4 as uuidv4 } from 'uuid'; //uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
export const getUserTempId=()=>{
let userTempId=localStorage.getItem('USERTEMPID_KEY')
    if (!userTempId){
        //创建新的userTempId
        userTempId=uuidv4();//⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
        //在存储到localStorage内部 保证下一次拿到的时候可以获取到
        localStorage.setItem('USERTEMPID_KEY',userTempId)
    }
    return  userTempId
}